<template>
  <div>
    <div class="i-layout-page-header mb20">
      <div class="i-layout-page-header">
        <span class="ivu-page-header-title">{{ $route.meta.title }}</span>
      </div>
    </div>
    <Card :bordered="false" dis-hover class="ivu-mt">
      <Form
        ref="roleData"
        :model="roleData"
        :label-width="labelWidth"
        :label-position="labelPosition"
        @submit.native.prevent
      >
	    <Row type="flex" :gutter="24">
	      <Col v-bind="grid">
	        <FormItem label="关键字：" label-for="keywords">
	          <Input
	            search
	            enter-button
	            placeholder="请输入关键字"
	            v-model="formValidate.keywords"
	            @on-search="userSearchs"
	          />
	        </FormItem>
	      </Col>
	    </Row>
        <Row type="flex">
          <Col v-bind="grid">
            <!-- <Button type="primary" @click="menusAdd('挂号')" icon="md-add">挂号</Button> -->
          </Col>
        </Row>
      </Form>
      <Table
        :columns="columns"
        :data="tableData"
        ref="table"
        :loading="loading"
        highlight-row
        no-data-text="暂无数据"
        no-filtered-data-text="暂无筛选结果"
        @on-select="handleSelectRow"
        @on-select-cancel="handleCancelRow"
        @on-select-all="handleSelectAll"
        @on-select-all-cancel="handleSelectAll"
        class="orderData mt25"
      >
	    <template slot-scope="{ row, index }" slot="id">
	      {{index+1}}
	    </template>
        <template slot-scope="{ row, index }" slot="no">
          <span>{{row.no}}号</span>
        </template>
		<template slot-scope="{ row, index }" slot="status">
		  <span v-if="row.status == 0">待支付</span>
		  <span v-else-if="row.status == 1">待就诊</span>
		  <span v-else-if="row.status == 2">就诊中</span>
		  <span v-else-if="row.status == 3">已看诊</span>
		  <span v-else-if="row.status == 4">已过号</span>
		  <span v-else>已取消</span>
		</template>
        <template slot-scope="{ row, index }" slot="action">
          <a @click="showResult(row)">查看结果</a>
		  <template v-if="row.is_today">
			  <Divider type="vertical"/>
			  <Dropdown @on-click="changeMenu(row, $event, index)" transfer="true">
			    <a href="javascript:void(0)">
			      更多操作
			      <Icon type="ios-arrow-down"></Icon>
			    </a>
			    <DropdownMenu slot="list">
			      <DropdownItem name="1">填写预检</DropdownItem>
			      <DropdownItem name="2">填写视功能检查</DropdownItem>
			      <DropdownItem name="3">填写看诊</DropdownItem>
			    </DropdownMenu>
			  </Dropdown>
		  </template>
        </template>
      </Table>
      <div class="acea-row row-right page">
        <Page
          :total="page.total"
          :current="page.pageNum"
          show-elevator
          show-total
          @on-change="pageChange"
          :page-size="page.pageSize"
          @on-page-size-change="limitChange"
        />
      </div>
    </Card>
    <check-result
      :formValidate="formValidate"
      :titleFrom="titleFrom"
      @getList="getList"
      @selectRule="selectRule"
      ref="checkResult"
      @clearFrom="clearFrom"
    ></check-result> 
  </div>
</template>

<script>
import { mapState } from 'vuex';
import { ListFinishedApi } from '@/api/register';
import formCreate from '@form-create/iview';
import checkResult from './components/checkResult'; 
import menusForm from './components/menusForm'; 
import mediaForm from './components/mediaForm'; 
import lampForm from './components/lampForm'; 
import funcForm from './components/funcForm'; 
export default {
  name: 'systemMenus',
  data() {
    return {
      tabconfig: { children: 'children', reserve: true, accordion: true },
      spinShow: false,
      grid: {
        xl: 7,
        lg: 7,
        md: 12,
        sm: 24,
        xs: 24,
      },
      roleData: {
        is_show: '',
        keyword: '',
      },
      loading: false,
      tableData: [],
      FromData: null,
      icons: '',
      formValidate: {},
      titleFrom: '',
      modalTitleSs: '',
	  archiveFrom:'',
	  columns: [
		{
	      title: '序号',
	      align: 'center',
	      slot: 'id',
	      width: 80,
	    },
		{
	      title: '患者',
	      align: 'center',
	      key: 'user_name',
	      width: 80,
	    },
		{
	      title: '就诊事项',
	      align: 'center',
	      key: 'sub_item_name',
	      width: 100,
	    },
		{
	      title: '医生',
	      align: 'center',
	      key: 'doc_name',
	      width: 80,
	    },
		{
	      title: '挂号时间',
	      align: 'center',
	      key: 'created_time',
	      width: 150,
	    },
		{
	      title: '就诊时间',
	      align: 'center',
	      key: 'see_time',
	      width: 150,
	    },
		{
	      title: '预约编号',
	      align: 'center',
	      slot: 'no',
	      width: 100,
	    },
		{
	      title: '就诊室',
	      align: 'center',
	      key: 'room_name',
	      width: 150,
	    },
		{
	      title: '挂号费用',
	      align: 'center',
	      key: 'amount',
	      width: 80,
	    },
		{
	      title: '状态',
	      align: 'center',
	      slot: 'status',
	      width: 100,
	    },
	    {
	      title: '操作',
	      slot: 'action',
	      fixed: 'right',
	      width: 150,
	      align: 'center',
	    },
	  ],
	  page: {
	    total: 0, // 总条数
	    pageNum: 1, // 当前页
	    pageSize: 10, // 每页显示条数
	  },
	  keywords:''
    };
  },
  components: { checkResult, formCreate: formCreate.$form() },
  computed: {
    ...mapState('admin/layout', ['isMobile']),
    labelWidth() {
      return this.isMobile ? undefined : 75;
    },
    labelPosition() {
      return this.isMobile ? 'top' : 'right';
    },
  },
  mounted() {
    this.getData();
  },
  methods: {
    // 查看详情
    detail(row) {
		console.info(111)
	  this.$router.push({ path: '/admin/contract/detail/' + row.id });
    },
    // 请求列表
    getList() {
      this.formValidate = Object.assign({}, this.$options.data().formValidate);
      this.getData();
    },
    selectRule(data) {
      this.formValidate.menu_name = data.real_name;
      this.formValidate.methods = data.method;
      this.formValidate.api_url = data.rule;
    },
    // 清除表单数据
    clearFrom() {
      this.formValidate = Object.assign({}, this.$options.data().formValidate);
    },
    // 删除
    del(row) {
      let delfromData = {
        title: '删除数据',
        url: `/subscribe/del/${row.id}`,
        method: 'GET',
        ids: '',
      };
      this.$modalSure(delfromData)
        .then((res) => {
          this.$Message.success(res.msg);
          this.getData();
        })
        .catch((res) => {
          this.$Message.error(res.msg);
        });
    },
    // 获取详情
    getDetails(id) {
		
    },
    // 编辑
    showResult(row, title, index) {
		let history  = '';
		if(row.show){
			if(row.show.jbs){
				history += '疾病史：否;';
			}else{
				history += row.show.jbs_text+';';
			}
			if(row.show.bms){
				history += '过敏史：否;';
			}else{
				history += row.show.bms_text+';';
			}
			if(row.show.sss){
				history += '手术史：否;';
			}else{
				history += row.show.sss_text+';';
			}
			if(row.show.jzs){
				history += '家族史：否;';
			}else{
				history += row.show.jzs_text+';';
			}
			if(row.show.qt.length > 0){
				history += row.show.qt+';';
			}
		}
		let fa  = '';
		if(row.show && row.show.programme.length > 0){
			let ids = row.show.programme.split(',').map(Number);
			ids.forEach(function(item,index){
				if(item == 1){
					fa+="普通单光镜;";
				}else if(item == 2){
					fa+="棱镜;";
				}else if(item == 3){
					fa+="渐进多焦镜;";
				}else if(item == 4){
					fa+="近视离焦镜;";
				}else if(item == 5){
					fa+="成长乐;";
				}else if(item == 6){
					fa+="美德可儿;";
				}else if(item == 7){
					fa+="大直径RGP;";
				}else if(item == 8){
					fa+="多焦点软镜;";
				}else if(item == 9){
					fa+="软镜;";
				}else if(item == 10){
					fa+="CME减负镜;";
				}
			});
			
		}
		//预检信息
		let content = '';
		if(row.record){
			//原镜检测
			if(row.record.yjjc_qj_right.length > 0 || row.record.yjjc_qj_left.length > 0){
				content += '原镜检测：'
			}
			if(row.record.yjjc_qj_right.length > 0){
				content += 'R：'+row.record.yjjc_qj_right+'/'+row.record.yjjc_zj_right+'X'+row.record.yjjc_zw_right+';';
			}
			if(row.record.yjjc_qj_left.length > 0){
				content += 'L：'+row.record.yjjc_qj_left+'/'+row.record.yjjc_zj_left+'X'+row.record.yjjc_zw_left+";";
			}
			//电脑验光
			if(row.record.dnyg_qj_right.length > 0 || row.record.dnyg_qj_left.length > 0){
				content += '电脑验光：'
			}
			if(row.record.dnyg_qj_right.length > 0){
				content += 'R：'+row.record.dnyg_qj_right+'/'+row.record.dnyg_zj_right+'X'+row.record.dnyg_zw_right+';';
			}
			if(row.record.dnyg_qj_left.length > 0){
				content += 'L：'+row.record.dnyg_qj_left+'/'+row.record.dnyg_zj_left+'X'+row.record.dnyg_zw_right+";";
			}
			//主觉验光
			if(row.record.zjyg_qj_right.length > 0 || row.record.zjyg_qj_left.length > 0){
				content += '主觉验光：'
			}
			if(row.record.zjyg_qj_right.length > 0){
				content += 'R：'+row.record.zjyg_qj_right+'/'+row.record.zjyg_zj_right+'X'+row.record.zjyg_zw_right+'='+row.record.zjyg_jzsl_right+";下架光："+row.record.zjyg_xjg_right+",棱镜："+row.record.zjyg_lj_right+';';
				
			}
			if(row.record.zjyg_qj_left.length > 0){
				content += 'L：'+row.record.zjyg_qj_left+'/'+row.record.zjyg_zj_left+'X'+row.record.zjyg_zw_left+'='+row.record.zjyg_jzsl_left+";下架光："+row.record.zjyg_xjg_left+",棱镜："+row.record.zjyg_lj_left+';';
			}
			//扩瞳验光
			if(row.record.ktyg_qj_right.length > 0 || row.record.ktyg_qj_left.length > 0){
				content += '扩瞳验光：'
			}
			if(row.record.ktyg_qj_right.length > 0){
				content += 'R：'+row.record.ktyg_qj_right+'/'+row.record.ktyg_zj_right+'X'+row.record.ktyg_zw_right+'='+row.record.ktyg_jzsl_right+";其他："+row.record.ktyg_else_right+';';
			}
			if(row.record.ktyg_qj_left.length > 0){
				content += 'L：'+row.record.ktyg_qj_left+'/'+row.record.ktyg_zj_left+'X'+row.record.ktyg_zw_left+'='+row.record.ktyg_jzsl_left+";其他："+row.record.ktyg_else_left+';';
			}
			//扩瞳验光
			if(row.record.ktyg_status == 1){
				content += '扩瞳验光否：复方托卡胺滴眼液';
			}else if(row.record.ktyg_status == 2){
				content += '扩瞳验光否：硫酸阿托品凝胶';
			}else if(row.record.ktyg_status == 3){
				content += '扩瞳验光否：其他';
			}
			//远距视力
			if(row.record.yjsl_od_sc.length > 0 || row.record.yjsl_od_cc.length > 0){
				content += '远距视力：'
			}
			if(row.record.yjsl_od_sc.length > 0){
				content += 'SC：'+'OD：'+row.record.yjsl_od_sc+';OS：'+row.record.yjsl_os_sc+';';
			}
			if(row.record.yjsl_od_cc.length > 0){
				content += 'CC:'+'OD：'+row.record.yjsl_od_cc+';OS：'+row.record.yjsl_os_cc+';';
			}
			
			//近距视力
			if(row.record.jjsl_od_sc.length > 0 || row.record.jjsl_od_cc.length > 0){
				content += '近距视力：'
			}
			if(row.record.jjsl_od_sc.length > 0){
				content += 'SC：'+'OD：'+row.record.jjsl_od_sc+';OS：'+row.record.jjsl_os_sc+';';
			}
			if(row.record.jjsl_od_cc.length > 0){
				content += 'CC:'+'OD：'+row.record.jjsl_od_cc+';OS：'+row.record.jjsl_os_cc+';';
			}
			//立体视
			if(row.record.lts.length > 0){
				content += '立体视：'+row.record.lts+';';
			}
			if(row.record.cyb == 1){
				content += '苍蝇本：圆圈;';
			}else if(row.record.cyb == 2){
				content += '苍蝇本：图案;';
			}
			//色觉
			if(row.record.sj == 1){
				content += '色觉：正常;';
			}else if(row.record.sj == 2){
				content += '色觉：红绿色盲;';
			}else if(row.record.sj == 3){
				content += '色觉：色弱;';
			}else if(row.record.sj == 4){
				content += '色觉：其他;';
			}
			
			//眼压
			if(row.record.ys_od.length > 0 || row.record.ys_os.length > 0){
				content += '眼压：'
			}
			if(row.record.ys_od.length > 0){
				content += 'OD：'+row.record.ys_od+';';
			}
			if(row.record.ys_os.length > 0){
				content += 'OS：'+row.record.ys_os+';';
			}
			//眼轴长度
			if(row.record.yzcd_od.length > 0 || row.record.yzcd_os.length > 0){
				content += '眼轴长度：'
			}
			if(row.record.yzcd_od.length > 0){
				content += 'OD：'+row.record.yzcd_od+';';
			}
			if(row.record.yzcd_os.length > 0){
				content += 'OS：'+row.record.yzcd_os+';';
			}
			//平K
			if(row.record.pk_od.length > 0 || row.record.pk_os.length > 0){
				content += '平K：'
			}
			if(row.record.pk_od.length > 0){
				content += 'OD：'+row.record.pk_od+';';
			}
			if(row.record.pk_os.length > 0){
				content += 'OS：'+row.record.pk_os+';';
			}
			//徒K
			if(row.record.tk_od.length > 0 || row.record.tk_os.length > 0){
				content += '徒K：'
			}
			if(row.record.tk_od.length > 0){
				content += 'OD：'+row.record.tk_od+';';
			}
			if(row.record.tk_os.length > 0){
				content += 'OS：'+row.record.tk_os+';';
			}
			//角膜散光
			if(row.record.jmsg_od.length > 0 || row.record.jmsg_os.length > 0){
				content += '角膜散光：'
			}
			if(row.record.jmsg_od.length > 0){
				content += 'OD：'+row.record.jmsg_od+';';
			}
			if(row.record.jmsg_os.length > 0){
				content += 'OS：'+row.record.jmsg_os+';';
			}
		}
		//视功能检查
		if(row.func){
			//原镜检测
			if(row.func.yqyd_eom_h > 0 || row.func.yqyd_eom_o > 0 || row.func.yqyd_eom_o_gs > 0){
				content += '眼球运动：';
				if(row.func.yqyd_eom_h > 0){
					if(row.func.yqyd_eom_h == 1){
						content += '完全';
					}else if(row.func.yqyd_eom_h == 2){
						content += '受限';
					}
				}
				
				if(row.func.yqyd_eom_h > 0){
					content += ' 追随：';
					if(row.func.yqyd_eom_o == 1){
						content += '平稳';
					}else if(row.func.yqyd_eom_o == 2){
						content += '不稳';
					}
				}
				
				if(row.func.yqyd_eom_o_gs > 0){
					content += ' 固视：';
					if(row.func.yqyd_eom_o_gs == 1){
						content += '良好';
					}else if(row.func.yqyd_eom_o_gs == 2){
						content += '不良';
					}
				}
				content += ';'
			}
			//调节幅度
			if(row.func.tjfd_od.length > 0 || row.func.tjfd_os.length > 0){
				content += '调节幅度：'
			}
			if(row.func.tjfd_od.length > 0){
				content += 'OD：'+row.func.tjfd_od+';';
			}
			if(row.func.tjfd_os.length > 0){
				content += 'OS：'+row.func.tjfd_os+';';
			}
			//调节灵活度
			if(row.func.tjlhd_od.length > 0 || row.func.tjlhd_os.length > 0 || row.func.tjlhd_ou.length > 0){
				content += '调节灵活度：'
			}
			if(row.func.tjlhd_od.length > 0){
				content += 'OD：'+row.func.tjlhd_od+'CPM('+row.func.tjlhd_od_cpm+');';
			}
			if(row.func.tjlhd_os.length > 0){
				content += 'OS：'+row.func.tjlhd_os+'CPM('+row.func.tjlhd_os_cpm+');';
			}
			if(row.func.tjlhd_ou.length > 0){
				content += 'OS：'+row.func.tjlhd_ou+'CPM('+row.func.tjlhd_ou_cpm+');';
			}
			//遮盖试验
			if(row.func.zgsy_yj_zw_od > 0 || row.func.zgsy_yj_zw_os > 0 || row.func.zgsy_jj_zw_od > 0 || row.func.zgsy_jj_zw_os > 0){
				content += '遮盖：';
			}
			if(row.func.zgsy_yj_zw_od > 0){
				content += '远距离：';
			}
			if(row.func.zgsy_yj_zw_od == 1){
				content += '内隐斜：';
			}else if(row.func.zgsy_yj_zw_od == 2){
				content += '外隐斜：';
			}
			
			if(row.func.zgsy_yj_zw_od_text.length > 0){
				content += row.func.zgsy_yj_zw_od_text+';';
			}
			
			if(row.func.zgsy_yj_zw_os == 1){
				content += '内斜视：';
			}else if(row.func.zgsy_yj_zw_os == 2){
				content += '外斜视：';
			}
			
			if(row.func.zgsy_yj_zw_os_text.length > 0){
				content += row.func.zgsy_yj_zw_os_text+';';
			}
			
			if(row.func.zgsy_jj_zw_od > 0 || row.func.zgsy_jj_zw_os > 0){
				content += '近距离：';
			}
			if(row.func.zgsy_jj_zw_od == 1){
				content += '内隐斜：';
			}else if(row.func.zgsy_jj_zw_od == 2){
				content += '外隐斜：';
			}
			if(row.func.zgsy_jj_zw_od_text.length > 0){
				content += row.func.zgsy_jj_zw_od_text+';';
			}
			
			if(row.func.zgsy_jj_zw_os == 1){
				content += '内斜视：';
			}else if(row.func.zgsy_jj_zw_os == 2){
				content += '外斜视：';
			}
			if(row.func.zgsy_jj_zw_os_text.length > 0){
				content += row.func.zgsy_jj_zw_os_text+';';
			}
			
			//集合近点
			if(row.func.jhjd_pl.length > 0 || row.func.jhjd_hf.length >0){
				content += '集合近点：'+row.func.jhjd_pl+'/'+row.func.jhjd_hf+';';
			}
			
			//聚散灵活度
			if(row.func.jslhd_yj.length > 0 || row.func.jslhd_jj.length > 0){
				content += '聚散灵活度：'
			}
			if(row.func.jslhd_yj.length > 0){
				content += "远距离："+row.func.jslhd_yj+'CPM('+row.func.jslhd_yj_cpm+');'
			}
			if(row.func.tjlhd_os.length > 0){
				content += "远距离："+row.func.jslhd_jj+'CPM('+row.func.jslhd_jj_cpm+');';
			}
			//处理意见
			if(row.func.hand_advise.length > 0){
				content += '处理意见：'+row.func.hand_advise+';';
			}
		}
		
		//裂隙灯检查
		if(row.lamp){
			//眼睑
			if(row.lamp.yj_od.length > 0 || row.lamp.yj_os.length > 0){
				content += '眼睑：'
			}
			if(row.lamp.yj_od.length > 0){
				content += 'OD：'+row.lamp.yj_od+';';
			}
			if(row.lamp.yj_os.length > 0){
				content += 'OS：'+row.lamp.yj_os+';';
			}
			//倒睫
			if(row.lamp.dj_od.length > 0 || row.lamp.dj_os.length > 0){
				content += '倒睫：'
			}
			if(row.lamp.dj_od.length > 0){
				content += 'OD：'+row.lamp.dj_od+';';
			}
			if(row.lamp.dj_os.length > 0){
				content += 'OS：'+row.lamp.dj_os+';';
			}
			//眼睑闭合
			if(row.lamp.yjbh_od.length > 0 || row.lamp.yjbh_os.length > 0){
				content += '眼睑闭合：'
			}
			if(row.lamp.yjbh_od.length > 0){
				content += 'OD：'+row.lamp.yjbh_od+';';
			}
			if(row.lamp.yjbh_os.length > 0){
				content += 'OS：'+row.lamp.yjbh_os+';';
			}
			if((row.lamp.yjbh_od.length > 0 || row.lamp.yjbh_os.length > 0) && row.lamp.yj_else.length > 0){
				content += '其他：'+row.lamp.yj_else+';';
			}
			
			//泪器
			if(row.lamp.lq_od.length > 0 || row.lamp.lq_os.length > 0){
				content += '泪器：'
			}
			if(row.lamp.lq_od.length > 0){
				content += 'OD：'+row.lamp.lq_od+';';
			}
			if(row.lamp.lq_os.length > 0){
				content += 'OS：'+row.lamp.lq_os+';';
			}
			//泪点
			if(row.lamp.ld_od.length > 0 || row.lamp.ld_os.length > 0){
				content += '泪点：'
			}
			if(row.lamp.ld_od.length > 0){
				content += 'OD：'+row.lamp.ld_od+';';
			}
			if(row.lamp.ld_os.length > 0){
				content += 'OS：'+row.lamp.ld_os+';';
			}
			if((row.lamp.ld_od.length > 0 || row.lamp.ld_os.length > 0) && row.lamp.ld_else.length > 0){
				content += '其他：'+row.lamp.ld_else+';';
			}
			
			//结膜
			if(row.lamp.jm_od.length > 0 || row.lamp.jm_os.length > 0){
				content += '结膜：'
			}
			if(row.lamp.jm_od.length > 0){
				content += 'OD：'+row.lamp.jm_od+';';
			}
			if(row.lamp.jm_os.length > 0){
				content += 'OS：'+row.lamp.jm_os+';';
			}
			if((row.lamp.jm_od.length > 0 || row.lamp.jm_os.length > 0) && row.lamp.jm_else.length > 0){
				content += '其他：'+row.lamp.jm_else+';';
			}
			
			//角膜
			if(row.lamp.jo_od.length > 0 || row.lamp.jo_os.length > 0){
				content += '角膜：'
			}
			if(row.lamp.jo_od.length > 0){
				content += 'OD：'+row.lamp.jo_od+';';
			}
			if(row.lamp.jo_os.length > 0){
				content += 'OS：'+row.lamp.jo_os+';';
			}
			if((row.lamp.jo_od.length > 0 || row.lamp.jo_os.length > 0) && row.lamp.jo_else.length > 0){
				content += '其他：'+row.lamp.jo_else+';';
			}
			
			//前房
			if(row.lamp.qf_od.length > 0 || row.lamp.qf_os.length > 0){
				content += '前房：'
			}
			if(row.lamp.qf_od.length > 0){
				content += 'OD：'+row.lamp.qf_od+';';
			}
			if(row.lamp.qf_os.length > 0){
				content += 'OS：'+row.lamp.qf_os+';';
			}
			if((row.lamp.qf_od.length > 0 || row.lamp.qf_os.length > 0) && row.lamp.qf_else.length > 0){
				content += '其他：'+row.lamp.qf_else+';';
			}
			
			//虹膜
			if(row.lamp.hm_od.length > 0 || row.lamp.hm_os.length > 0){
				content += '虹膜：'
			}
			if(row.lamp.hm_od.length > 0){
				content += 'OD：'+row.lamp.hm_od+';';
			}
			if(row.lamp.hm_os.length > 0){
				content += 'OS：'+row.lamp.hm_os+';';
			}
			if((row.lamp.hm_od.length > 0 || row.lamp.hm_os.length > 0) && row.lamp.hm_else.length > 0){
				content += '其他：'+row.lamp.hm_else+';';
			}
			
			//瞳孔
			if(row.lamp.tk_od.length > 0 || row.lamp.tk_os.length > 0){
				content += '瞳孔：'
			}
			if(row.lamp.tk_od.length > 0){
				content += 'OD：'+row.lamp.tk_od+';';
			}
			if(row.lamp.tk_os.length > 0){
				content += 'OS：'+row.lamp.tk_os+';';
			}
			if((row.lamp.tk_od.length > 0 || row.lamp.tk_os.length > 0) && row.lamp.tk_else.length > 0){
				content += '其他：'+row.lamp.tk_else+';';
			}
			//晶体
			if(row.lamp.jt_od.length > 0 || row.lamp.jt_os.length > 0){
				content += '晶体：'
			}
			if(row.lamp.jt_od.length > 0){
				content += 'OD：'+row.lamp.jt_od+';';
			}
			if(row.lamp.jt_os.length > 0){
				content += 'OS：'+row.lamp.jt_os+';';
			}
			if((row.lamp.jt_od.length > 0 || row.lamp.jt_os.length > 0) && row.lamp.jt_else.length > 0){
				content += '其他：'+row.lamp.jt_else+';';
			}
			//玻璃体
			if(row.lamp.blt_od.length > 0 || row.lamp.blt_os.length > 0){
				content += '玻璃体：'
			}
			if(row.lamp.blt_od.length > 0){
				content += 'OD：'+row.lamp.blt_od+';';
			}
			if(row.lamp.blt_os.length > 0){
				content += 'OS：'+row.lamp.blt_os+';';
			}
			if((row.lamp.blt_od.length > 0 || row.lamp.blt_os.length > 0) && row.lamp.blt_else.length > 0){
				content += '其他：'+row.lamp.blt_else+';';
			}
		}
		
		
		this.formValidate = {
			username:row.userinfo.name,
			sex:row.userinfo.sex,
			age:row.userinfo.age,
			no:row.userinfo.no,
			see_time:row.see_time,
			main_chinf:row.show?row.show.main_chinf:'',
			hpi:row.show?row.show.hpi:'',
			history:history,
			primary_diagnosis:row.show?row.show.primary_diagnosis:'',
			handle_advise:row.show?row.show.handle_advise:'',
			fa:fa,
			content:content
		};
		console.info(this.formValidate)
		this.titleFrom = '查看结果';
	    this.$refs.checkResult.modals = true;
    },
    // 添加
    menusAdd(title) {
      this.formValidate = {};
      this.$refs.checkResult.modals = true;
      this.$refs.checkResult.valids = false;
      // this.formValidate = Object.assign(this.$data, this.$options.formValidate());
      this.titleFrom = title;
    },
    // 新增页面表单
    // getAddFrom () {
    //     this.spinShow = true;
    //     addMenus(this.roleData).then(async res => {
    //         this.FromData = res.data;
    //         this.$refs.checkResult.modals = true;
    //         this.spinShow = false;
    //     }).catch(res => {
    //         this.spinShow = false;
    //         this.$Message.error(res.msg);
    //     })
    // },
    // 列表
    getData() {
		// this.page.pageNum = res === 1 ? 1 : this.page.pageNum;
		this.loading = true;
		ListFinishedApi({
		  page: this.page.pageNum,
		  limit: this.page.pageSize,
		  keywords:this.keywords
		})
		  .then(async (res) => {
		    let data = res.data;
		    this.tableData = data.list;
		    this.page.total = data.count;
		    this.loading = false;
		  })
		  .catch((res) => {
		    this.loading = false;
		    this.$Message.error(res.msg);
		  });
    },
	pageChange(index) {
	  this.page.pageNum = index;
	  this.getData();
	},
	limitChange(limit) {
	  this.page.pageSize = limit;
	  this.getData();
	},
    // 关闭按钮
    cancel() {
      this.$emit('onCancel');
    },
	//  选中某一行
	handleSelectRow(selection, row) {
	  this.isDel(selection);
	  this.selectedIds.add(row.id);
	  this.$nextTick(() => {
	    //确保dom加载完毕
	    this.setChecked();
	  });
	},
	//  取消某一行
	handleCancelRow(selection, row) {
	  this.isDel(selection);
	  this.selectedIds.delete(row.id);
	  this.$nextTick(() => {
	    //确保dom加载完毕
	    this.setChecked();
	  });
	},
	//全选和取消全选时触发
	handleSelectAll(selection) {
	  if (selection.length === 0) {
	    //获取table的数据；
	    let data = this.$refs.table.data;
	    data.forEach((item) => {
	      if (this.selectedIds.has(item.id)) {
	        this.selectedIds.delete(item.id);
	      }
	    });
	  } else {
	    selection.forEach((item) => {
	      this.selectedIds.add(item.id);
	    });
	  }
	  this.isDel(selection);
	  this.$nextTick(() => {
	    //确保dom加载完毕
	    this.setChecked();
	  });
	},
	userSearchs(){
		this.keywords = this.formValidate.keywords;
		this.page.pageNum = 1;
		this.getData();
		console.info(this.formValidate)
	},
	finished(row){
		this.delfromData = {
		  title: '就诊完成',
		  info: '确认已完成患者就诊吗?',
		  url: `/register/finished/${row.id}`,
		  method: 'get',
		  ids: '',
		};
		this.$modalSure(this.delfromData)
		  .then((res) => {
		    this.$Message.success(res.msg);
		    this.getList();
		  })
		  .catch((res) => {
		    this.$Message.error(res.msg);
		  });
	},
	
	// 操作
	changeMenu(row, name, index) {
	  switch (name) {
	    case '1':
			this.edit(row);
			break;
	    case '2':
			this.funcEdit(row);
			break;
	    case '3':
			this.finished(row);
			break;
	    default:
			break;
	  }
	},
  },
};
</script>

<style scoped lang="stylus">
.vxeTable {
  >>> .vxe-table--header-wrapper {
    background: #fff !important;
  }
}
</style>
